/*
 *	Copyright (C) 2008 CRIMERE
 *	Copyright (C) 2008 Jean-Marc Mercier
 *	
 *	This file is part of OTS (optimally transported schemes), an open-source library
 *	dedicated to scientific computing. http://code.google.com/p/optimally-transported-schemes/
 *
 *	CRIMERE makes no representations about the suitability of this
 *	software for any purpose. It is provided "as is" without express or
 *	implied warranty.
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
#include <src/miscellaneous/OS_basic.h>
#include <src/data/Operators.h>
#include <src/math/Operators/delta_particle.h>
#include <src/math/Stochastic/StochasticProcesses.h>

#if !defined(_StochasticParticlesOperators_)
#define _StochasticParticlesOperators_

template <class WeightSet, class StochasticProcess>
class StochasticParticlesOperators : 
	public TimeOperator<typename WeightSet::p_array_2, typename WeightSet::p_array_2, typename StochasticProcess::time_type>,
	public ParticlesOperators<WeightSet> 
{
public :
	typedef typename WeightSet											weight_set_type;
	typedef StochasticParticlesOperators<weight_set_type,StochasticProcess>	time_operator_type;
	typedef ParticlesOperators<weight_set_type>							Base;
	typedef typename Delta_p<weight_set_type>							Delta_p_t;
	typedef typename weight_set_type::indice_type						indice_type;
	typedef typename weight_set_type::state_variable_type				state_variable_type;
	typedef typename weight_set_type::weight_type						weight_type;

	StochasticParticlesOperators(const smart_ptr<weight_set_type> & from) 
		: Delta_(from), Base(from) {}
	result_type operator()(first_argument_type time,second_argument_type arg) const 
	{
		result_type local(Delta_(arg));
//			local[i] = process_->mu(time,arg[i]) + process_->sigma(time,arg[i]) * local[i];
		return local;
	}
private :
	smart_ptr<StochasticProcess>				process_;
	Delta_p_t									Delta_;
};

#endif